<template>
  <div class="main">
    <el-row>
      <el-col :sm="4" :md="4" class="enter" @click.native="enterInfos">钱袋子收银</el-col>
      <el-col :sm="20" :md="20" class="enter" >
        <el-button @click.native="viewMin">最小化</el-button>
        <el-button @click.native="viewMax">全屏</el-button>
        <el-button @click.native="viewClose">关闭</el-button>
      </el-col>
    </el-row>
    <div>
      <el-row>
        <el-col :sm="12" :md="12" >
          icon
        </el-col>
        <el-col :sm="12" :md="12" >
          <el-input
            placeholder="手机号或手机号后四位"
            prefix-icon="el-icon-search"
            v-model="user.mobile">
          </el-input>
          <el-input
            placeholder="6~16位数字字母组合"
            prefix-icon="el-icon-search"
            v-model="user.password">
          </el-input>
          <el-button type="success" @click.native="login">登录按钮</el-button>
        </el-col>
      </el-row>
    </div>

    <el-row class="foot">
      <el-col :span="24">版本：0.0.125</el-col>
    </el-row>
  </div>
</template>

<script>
const {ipcRenderer: ipc} = require('electron')
const {ipcRenderer} = require('electron')


export default {
  name: 'index',
  data () {
    return {
      user: {
        mobile: '17707125668',
        password: '123456'
      }
    }
  },
  created () {
  },
  mounted() {
    ipcRenderer.send('asynchronous-message', 'ping')
    ipcRenderer.on('asynchronous-reply', (event, arg) => {
        console.log(arg) // prints "pong"
    })
  },
  methods: {
    viewMin () {
      ipc.send('min')
    },
    viewMax () {
      ipc.send('max')
    },
    viewClose () {
      ipc.send('close')
    },
    async login () {
      console.log(11);
      let params = {
        user_name: this.user.mobile,
        password: this.user.password,
      }
      // const data = await this.http.post(this.api.login, params)
      // if (data.code === 1) {
      //   console.log(data);
      // } else {
      //   console.log(data);
      // }
      this.jump({name: 'account'})
    }
  }
}
</script>

<style lang="stylus" scoped>
// .enter
//   margin-top 12rem
//   margin-bottom 12rem
//   color #085eee
//   border-radius 20%
//   min-height 10rem
//   line-height 10rem
//   text-align center
//   box-shadow 0 0 2rem #d0d0d0
// .foot
//   position fixed
//   color #999999
//   bottom 2rem
//   left 40%
</style>

